<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:th="http://www.thymeleaf.org"
      layout:decorator="backstage/layout">
<head>
    <title>邀请码管理</title>
</head>

<body>
<div id="content" layout:fragment="content">
<script type="text/javascript" src="../../admin/js/bootstrap-paginator.js"></script>
<script type="text/javascript" src="../../admin/ace/js/fuelux/fuelux.spinner.min.js"></script>
<script type="text/javascript" src="../../admin/ace/js/ace-elements.min.js"></script>
<script type="text/javascript" src="../../admin/js/invitationCode.js"></script>
    <script type="text/javascript">
    function paging(page){
	    $("[name=page]").val(page);
	    $("#searchForm").submit();
	}
    $(function(){
    	
      var options = {
                currentPage: $("[name=page]").val(),
                totalPages: $("[name=totalPage]").val(),
                alignment:"left",
                itemTexts: function (type, page, current) {
                    switch (type) {
                        case "first":
                            return "首页";
                        case "prev":
                            return "上一页";
                        case "next":
                            return "下一页";
                        case "last":
                            return "末页";
                        case "page":
                            return page;
                    }
                },
                pageUrl: function(type,page,current){
                    return "javascript:paging('"+page+"');";
                }
            }
        $('#example').bootstrapPaginator(options);                                    
        
        $(".btn-inverse").click(function(e){
            $("[name=page]").attr("value","1");
        })
    });
    
    </script>
    <div class="box-content">
        <div class="row-fluid sortable">
            <div class="box span12">
                <h3 class="row-fluid header smaller lighter blue">
                   <span class="label label-large label-pink arrowed-right">邀请码管理</span>
                </h3>                                  
                 <form action="/invitationCode/invitationCodeList.htm" method="post" id="searchForm">
			        <input type="hidden"  id="page" name="page" th:value="${page.page}" />
		            <input type="hidden"  name="totalPage" th:value="${page.totalPage}" />
		            <input type="hidden"  name="total" th:value="${page.total}" />
		            <span class="topword">邀请码数量：</span>
		            <input type="text" class="input-xlarge focused" id="inputSize"/> 
		            	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		            <input type="button" class="btn btn-info tpbtn" value="生成邀请码" onclick="addCode()"/>	          			           
                 </form>
                <div class="box-content">
                    <table class="table table-striped table-bordered bootstrap-datatable datatable">
                        <thead>
                        <tr >
                            <th style="text-align: center;">序号</th>
                            <th style="text-align: center;">邀请码</th>
                            <th style="text-align: center;">是否被使用</th>
                            <th style="text-align: center;">创建时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="icode,indexStat:${page.result}">
                            <td th:text="${indexStat.count}" style="text-align: center;"></td>
                            <td th:text="${icode.code}" style="text-align: center;"></td>
                            <td th:text="${icode.status}" style="text-align: center;"></td>
                            <td th:text="${icode.createTime}" style="text-align: center;"></td>
                        </tr>
                        </tbody>
                    </table>
                    
                     <div style="margin-bottom: 0px; margin-left: auto;margin-right: auto">
                        <div id="example" style="margin-bottom:0px"></div>
                     </div>
                </div>
            </div><!--/span-->
        </div><!--/row-->
    </div>
</div>
</body>
</html>
